<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('测点配置列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
              
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-success" onclick="$.operate.add()" >
                    <i class="fa fa-plus"></i> 添加
                </a>
                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" >
                    <i class="fa fa-edit"></i> 修改
                </a>
                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" >
                    <i class="fa fa-remove"></i> 删除
                </a>
                <a class="btn btn-warning" onclick="$.table.exportExcel()">
                    <i class="fa fa-download"></i> 导出
                 </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
      var datas1 = [[${@dict.getType('sys_tag_caltype')}]];
      var datas2 = [[${@dict.getType('sys_tag_limittype')}]];
        var editFlag = [[${@permission.hasPermi('self:self:edit')}]];
        var removeFlag = [[${@permission.hasPermi('self:self:remove')}]];
        var prefix = ctx + "self/self";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                echartUrl: prefix +"/echart/{id}",
                exportUrl: prefix + "/export",
                modalName: "测点配置",
                columns: [{
                    checkbox: true
                },
                {
                    field : 'id', 
                    title : '测点ID',
                    visible: false
                },
                {
                    field : 'tagname', 
                    title : '测点名称'
                },
                {
                    field : 'pitagname', 
                    title : 'PI测点名'
                },
                {
                	 field : 'calctype', 
	                 title : '计算类型',
	                 formatter: function(value, item, index) {
			            	return $.table.selectDictLabel(datas1, item.calctype);
			            }
                },
                {
                	  field: 'limittype',
  		            title: '限值类型',
  	                 formatter: function(value, item, index) {
  			            	return $.table.selectDictLabel(datas2, item.limittype);
  			            }
                },
                {
                    field : 'upperval', 
                    title : '上限限值'
                },
                {
                    field : 'lowerval', 
                    title : '下限限值'
                }
                ,
		        {
                    title: '测点规则',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs '   + '" href="javascript:void(0)" onclick="$.operate.echartReport(\'' + row.id + '\')"><i class="fa fa-edit"></i>详情</a> ');
                        return actions.join('');
                    }
                }
		        
		        ]
            };
            $.table.init(options);
        });
    </script>
</body>
</html>